package com.modebing.es;

import com.modebing.es.entity.Product;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.client.RestClients;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class SpringDataESIndexTest {
    @Autowired
    private ElasticsearchRestTemplate elasticsearchRestTemplate;


    @Test
    public void createIndex(){
        //创建索引

        log.info("-------创建索引：{}-------");
    }

    @Test
    public void deleteIndex(){
        //创建索引
        boolean flag = elasticsearchRestTemplate.deleteIndex(Product.class);

        log.info("-------删除索引：{}-------",flag);
    }
}
